import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
	{
		path: '/',
		name: 'home',
		component: () => import('../views/Home.vue')
	},
	{
		path: '/hotsearch',
		name: 'hotsearch',
		component: () => import('../views/HotSearch.vue')
	},
	{
		path: '/administrator',
		name: 'administrator',
		component: () => import('../views/Administrator.vue'),
		children: [
			// {
			// 	path: '',
			// 	name: 'usermanager',
			// 	component: () => import('../views/admins/UserManager.vue')
			// },
			{
				path: '',
				name: 'articlemanager',
				component: () => import('../views/admins/ArticleManager.vue')
			},
			{
				path: '/noticemanager',
				name: 'noticemanager',
				component: () => import('../views/admins/NoticeManager.vue')
			},
			{
				path: '/taskmanager',
				name: 'taskmanager',
				component: () => import('../views/admins/TaskManager.vue')
			},
			{
				path: '/publishnotice',
				name: 'publishnotice',
				component: () => import('../views/admins/PublishNotice.vue')
			}
		]
	},
	{
		path: '/administratorlogin',
		name: 'administratorlogin',
		component: () => import('../views/AdministratorLogin.vue')
	},
	{
		path: '/login',
		name: 'login',
		component: () => import('../views/Login.vue'),
		children: [
			{
				path: '',
				name: 'personal-info',
				component: () => import('../views/main/PersonalInfo.vue')
			},
			{
				path: 'my-articles',
				name: 'my-articles',
				component: () => import('../views/main/MyArticles.vue'),
			},
			{
				path: 'my-articles/articles/:id',  // 动态路由，展示特定文章
				name: 'articles-show',
				component: () => import('../views/main/ArticlesShow.vue'),
				props: true  // 将路由参数作为 props 传递给组件
			},
			{
				path: 'my-tasks',
				name: 'my-tasks',
				component: () => import('../views/main/MyTasks.vue')
			},
			{
				path: 'my-tasks/tasks/:id',  // 动态路由，展示特定文章
				name: 'tasks-show',
				component: () => import('../views/main/TasksShow.vue'),
				props: true  // 将路由参数作为 props 传递给组件
			}
		]
	},
	{
		path: '/notice',
		name: 'notice',
		component: () => import('../views/Notice.vue')
	},
	{
		path: '/personal',
		name: 'personal',
		component: () => import('../views/Personal.vue'),
		children: [
			{
				path: '',
				name: 'personalinfo',
				component: () => import('../views/PersonalInfo.vue')
			},
			{
				path: 'personaltask',
				name: 'personaltask',
				component: () => import('../views/PersonalTask.vue')
			}
		]
	},
	{
		path: '/publish',
		name: 'publish',
		component: () => import('../views/Publish.vue')
	},
	{
		path: '/task',
		name: 'task',
		component: () => import('../views/Task.vue')
	},
    {
        path: '/login02',
        name: 'login02',
        component: () => import('../views/Login02.vue')
    },
	{
		path: '/register',
		name:'register',
		component: () => import('../views/Register.vue')
	}
    
]

const routers = createRouter({
	history: createWebHashHistory(),
	routes
})

export default routers